<template>
    <div>
        <el-row>
            <el-col :span="1" class="labelCol">
                <p class="labelText">选择日期:</p>
            </el-col>
            <el-col :span="4">
                <el-date-picker v-model="queryDate" size="small" type="date" clearable placeholder="选择日期">
                </el-date-picker>
            </el-col>
            <el-col :span="2" style="text-align: center;">
                <el-button type="primary" size="small" @click="query">查询</el-button>
            </el-col>
        </el-row>

        <table class="report_table" cellspacing="0" cellpadding="0" width="100%">
            <!--表格开始-->
            <tbody>
                <tr class="texttbody" height="60px;">
                    <th scope="col">SA姓名</th>
                    <th scope="col">导入日期</th>
                    <th scope="col">新导入工单数</th>
                    <th scope="col">新导入车辆数</th>
                </tr>
                <tr v-for="item in tableData.dataList">
                    <td>{{item.SA}}</td>
                    <td>{{item.impDate}}</td>
                    <td>{{item.woCount}}</td>
                    <td>{{item.carCount}}</td>
                </tr>

            </tbody>
        </table>

    </div>
</template>
<script>
export default {
    data: function () {
        return {
            queryDate: '',
            //分组数据
            tableData: {
                total: 0,
                dataList: []
            },
        }
    },
    methods: {
        query: function () {
            debugger;
            var dates;
            if (this.$data.queryDate == '') {
                this.$data.queryDate = this.moment(new Date()).format("YYYY-MM-DD")
            }
            else {
               this.$data.queryDate = this.moment(this.$data.queryDate).format("YYYY-MM-DD");
            }

            this.$http({
                method: 'GET',
                url: this.API_ROOT + '/crm/kpi/newCarOrder', //url
                params: { //发送的参数
                    mDate: this.$data.queryDate,
                }
            }).then(function (resp) {
                this.$data.tableData = resp.data;
            }, function (error) {
                // error
            })
        },
        created: function () {
            this.query()
        }
    }
}
</script>

